﻿using SharedContracts.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TalentDesk.Contracts.Ef;
using TalentDesk.Contracts.ServiceContracts;
using TalentDesk.Mvc.HelperClasses;

namespace TalentDesk.Mvc.Models
{
    public class ProjectProxy
    {

        public static List<Project> GetProjects(bool p_bInclude = false)
        {
            List<Project> result = null;
            new ProxyHelper<IProjectService>().Use(serviceProxy =>
            {
                result = serviceProxy.GetProjects(p_bInclude);
            },
              EndpointConstants.BasicHttpBinding_IProjectService);

            return result;
        }

        public static Project GetProjectByProjectId(int p_iProjectId, bool p_bInclude = false)
        {
            Project result = null;
            new ProxyHelper<IProjectService>().Use(serviceProxy =>
            {
                result = serviceProxy.GetProjectByProjectId(p_iProjectId, p_bInclude);
            },
              EndpointConstants.BasicHttpBinding_IProjectService);

            return result;
        }

        public static int SaveProject(Project p_oProject, List<ProjectTeam> p_lProjectTeams = null, List<Attachment> p_lAttachments = null)
        {
            int result=0;
            new ProxyHelper<IProjectService>().Use(serviceProxy =>
            {
                result = serviceProxy.SaveProject(p_oProject, p_lProjectTeams, p_lAttachments);
            },
              EndpointConstants.BasicHttpBinding_IProjectService);

            return result;
        }



    }
}